package com.zjitc.book.service.impl;

import com.zjitc.book.entity.Book;
import com.zjitc.book.mapper.BookMapper;
import com.zjitc.book.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookServiceImpl implements BookService {

    @Autowired
    private BookMapper bookMapper;

    @Override
    public List<Book> getBooks() {
        return bookMapper.getBooks();
    }

    @Override
    public Book getBooksById(Integer id) {
        return bookMapper.getBooksById(id);
    }

    @Override
    public int deleteBookById(Integer id) {
        return bookMapper.deleteBookById(id);
    }

    @Override
    public int updateBookById(Integer id, Book book) {
        return bookMapper.updateBookById(id,book);
    }

    @Override
    public int insertBook(Book book) {
        return bookMapper.insertBook(book);
    }

    @Override
    public List<Book> searchBooksByCondition(Book book) {
        return bookMapper.searchBooksByCondition(book);
    }
}
